﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;

namespace 第30章ADO.NET核心
{
    class Program
    {
        static void Main(string[] args)
        {
            string source = "server=(local);"
                + "integrated security=SSPI;"
                + "database=test";
            SqlConnection conn = new SqlConnection(source);
            conn.Open();
            string select = "Select * from student";
            SqlCommand cmd = new SqlCommand(select, conn);
            SqlDataReader reader = cmd.ExecuteReader();
            int index = 0;
            
            while (reader.Read())
            {
                Console.WriteLine(reader["id"] + "名字" + reader["name"]+"内容"+reader["value"]);
               
            }
            //DO Something useful
            conn.Close();
            
        }
    }
}
